﻿@model SILAS.Entidades.Capacitacion

@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_LayoutGeneral.cshtml";
}

<h2>Edit</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@section js{

    <script type="text/javascript">

        $(function () {

            $("#btnGuardar").click(function () {

                var data = $('form').serialize();

                $.post('@Url.Action("Edit", "Capacitacion")',
                         data,
                         function (ok) {
                             if (ok) {
                                 if (ok.exito == true) {
                                     alert(ok.msg);
                                     window.location = '@Url.Action("ListaCapacitaciones", "Capacitacion")';
                                 }
                                 else {
                                     alert(ok.msg);
                                 }
                             }
                         }, "json");
            });

        });
       
    </script>
}


@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Capacitacion</legend>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.Tematica)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Tematica)
            @Html.ValidationMessageFor(model => model.Tematica)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Organizador)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Organizador)
            @Html.ValidationMessageFor(model => model.Organizador)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.DirigidoA)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.DirigidoA)
            @Html.ValidationMessageFor(model => model.DirigidoA)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.NroAsistentes)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.NroAsistentes)
            @Html.ValidationMessageFor(model => model.NroAsistentes)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Observaciones)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Observaciones)
            @Html.ValidationMessageFor(model => model.Observaciones)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Fecha)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Fecha)
            @Html.ValidationMessageFor(model => model.Fecha)
        </div>

        <p>
            <button id="btnGuardar" type="button">Guardar</button> 
        </p>
    </fieldset>
}

<div>
     @Html.ActionLink("Regresar", "ListaCapacitaciones")
</div>

